import { IFeidaoAiBrowserComponent } from '../../interfaces';
import get from '../local/get';
import remove from '../local/remove';

/**
 * 停止并清除定时器
 * @param fd 系统参数
 * @param id 定时器id
 * @example stop_timer(fd,id);
 */
export default function stop_timer(fd: IFeidaoAiBrowserComponent, id: string) {
	const timer_id = `fd-timer-${id}`;
	const timer = get<number>(fd, timer_id);
	if (timer) {
		clearInterval(timer);
	}
	remove(fd, timer_id);
}
